package ${localPackage}.controller;

import ${localPackage}.entity.${gvo.entityName};
import ${localPackage}.vo.${gvo.entityName}VO;
import ${localPackage}.service.${gvo.entityName}Service;

import ${localPackage}.utils.ReJson;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

/**
* Created by chenyuncong on 2018/9/3.
* 电子围栏
*/
@Controller
@RequestMapping(value = "${gvo.headSmallEntityName}")
public class ${gvo.entityName}Contorller {
    @Autowired
    private ${gvo.entityName}Service ${gvo.headSmallEntityName}Service;



    /**
    * 获取数据列表
    * @return
    */
    @RequestMapping("get${gvo.entityName}List")
    @ResponseBody
    public ReJson get${gvo.entityName}List(${gvo.entityName}VO vo){
        ReJson re = ${gvo.headSmallEntityName}Service.get${gvo.entityName}List(vo);
        return re;
    }

    /**
    * 保存数据
    * @param vo
    * @return
    */
    @RequestMapping("save${gvo.entityName}.htm")
    @ResponseBody
    public String save${gvo.entityName}(${gvo.entityName}VO vo){
        ${gvo.headSmallEntityName}Service.save(vo);
        return "1";
    }

    /**
    * 删除数据
    * @param ids
    * @return
    */
    @RequestMapping("del${gvo.entityName}.htm")
    @ResponseBody
    public String del${gvo.entityName}(@RequestBody Integer [] ids){
        ${gvo.headSmallEntityName}Service.delete(ids);
        return "1";
    }

    /**
    * 更新数据
    * @param vo
    * @return
    */
    @RequestMapping("update${gvo.entityName}.htm")
    @ResponseBody
    public String update${gvo.entityName}(${gvo.entityName}VO vo){
        ${gvo.headSmallEntityName}Service.update(vo);
        return "1";
    }

    /**
    * 获取数据列表
    * @return
    */
    @RequestMapping("get${gvo.entityName}")
    @ResponseBody
    public ${gvo.entityName} get${gvo.entityName}(Integer id){
        ${gvo.entityName} re = ${gvo.headSmallEntityName}Service.get${gvo.entityName}ById(id);
        return re;
    }

}